package com.example.myapplication;

import android.os.Bundle;

import androidx.appcompat.app.AppCompatActivity;

import android.view.Gravity;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;

public class uc1 extends AppCompatActivity {

    LinearLayout buttonLayout;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_uc1);

        buttonLayout = findViewById(R.id.buttonLayout);

        Button btnHorizontal = findViewById(R.id.btnHorizontal);
        Button btnVertical = findViewById(R.id.btnVertical);
        Button btnAlignLeft = findViewById(R.id.btnAlignLeft);
        Button btnBack = findViewById(R.id.button_uc1);

        btnHorizontal.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                buttonLayout.setOrientation(LinearLayout.HORIZONTAL);
                buttonLayout.setGravity(Gravity.CENTER);
            }
        });

        btnVertical.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                buttonLayout.setOrientation(LinearLayout.VERTICAL);
                buttonLayout.setGravity(Gravity.CENTER);
            }
        });

        btnAlignLeft.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                buttonLayout.setGravity(Gravity.START);
            }
        });

        btnBack.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
    }
}